'''
mx='haPpy birthDay to yOu'
for x in mx:
    if 'A'<=x<='Z':
        x=x.lower()
    else:
        continue
print(mx)

lst_info=[['Tom',18,2000],['Jack',19,1999],['Marry',20,1998]]
lst_name=[];lst_age=[]
for i in range(len(lst_info)):
    lst_name.append(lst_info[i][0])
    lst_age.append(lst_info[i][2])
dic=dict(zip(lst_name,lst_age))
print(dic)

a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,162,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20]
a.sort()
b = []
i = 0
while i < len(a):
    if a[i] not in b:
        b.append(a[i])
    else:
        i += 1
print(b)
b = {}
b = list(b.fromkeys(a))
print(b)
import numpy as np
n1 = np.random.randint(100, 2000)
n2 = np.random.randint(100, 2000)

def search(a):
    factors = set( [i for i in np.arange(1, a + 1) if a % i == 0] )
    return factors
factors1 = search(n1)
factors2 = search(n2)
print(f"{n1} 的因数集合：{factors1}")
print(f"{n2} 的因数集合：{factors2}")

#判断两个整数中是否有素数并输出
def judge(a):
    global flag
    factors = search(a)
    if len(factors) == 2:
        flag = 0
        print("随机生成数的素数是{}".format(a))
        return flag
flag = 1
judge(n1)
judge(n2)
if flag == 1:
    print("随机生成数中没有素数")

#转集合为数组
arr1 = np.array(list(factors1))
arr2 = np.array(list(factors2))
#使用库函数
common_factor = np.intersect1d(arr1, arr2)

#不使用库函数
common_factor = set()
for i in arr1:
    for j in arr2:
        if i == j:
            common_factor.add(i)
print("两个数的公因数：")
print(common_factor)

print("两个数的最大公因数是：{}".format(max(common_factor)))

if max(common_factor) == 1:

    print(f"两个数的最大公因数是1，所以{n1} 和 {n2} 互素。")

    
def palindrome(n): 
    count = 0 
    for i in range(10**(n-1), 10**n): 
        if  i % 7 == 0 and str(i) == str(i)[::-1]: 
            print(i) 
            count += 1 
    return count
n1 = int(input("请输入一个不大于6的正整数:")) 
print("共有{}个{}位回文数".format(palindrome(n1),n1))
n2 = int(input("请输入另一个不大于6的正整数:")) 
print("共有{}个{}位回文数".format(palindrome(n2),n2))

def get_key(My_dict, value):
    for key, val in My_dict.items():
        if isinstance(val, list) and value in val:
            return key
    return None
keys = ["西安","宝鸡","渭南","咸阳","铜川","汉中","安康","商洛","延安","榆林"]
values = ["029","0917","0913","029","0919","0916","0915","0914","0911","0912"]
My_dict = dict(zip(keys,values))
print(My_dict)

def search_dict(my_dict, search_list):
    result_dict={}
    for item in search_list:
        keys = [ key for key,value in my_dict.items() if value == item ]
        result_dict[item]= keys
    return result_dict
my_dict={"西安":"029","宝鸡":"0917","渭南":"0913","咸阳":"029","铜川":"0919","汉中":"0916","安康":"0915","商洛":"0914","延安":"0911","榆林":"0912"}
search_list=["029","0913","0918"]
result= search_dict(my_dict, search_list)
print(result)
'''
